* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 20px 30px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 标题区域 */
.title-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Logo样式 */
.logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.logo:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

header h1 {
    color: white;
    font-size: 1.67rem;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

header h1:hover {
    text-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

/* 编辑标题按钮 */
.edit-title-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    opacity: 0.7;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-title-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
    transform: scale(1.1);
}

.edit-title-btn:active {
    transform: scale(0.95);
}

/* 头部按钮容器 */
.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.add-btn, .export-btn, .import-btn, .refresh-btn {
    border: none;
    padding: 8px 16px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    color: white;
}

.add-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.export-btn {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
}

.import-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.import-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.refresh-btn {
    background: linear-gradient(45deg, #ffa726, #ff9800);
    box-shadow: 0 4px 15px rgba(255, 167, 38, 0.3);
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 167, 38, 0.4);
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.categories {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.category {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 分类标题容器 */
.category-title-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.category h2 {
    color: #333;
    margin: 0;
    font-size: 1.2rem;
    font-weight: 500;
    flex: 1;
}

/* 分类拖拽手柄 */
.category-handle {
    color: #999;
    cursor: grab;
    padding: 5px;
    margin-right: 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.category-handle:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    opacity: 1;
}

.category-handle:active {
    cursor: grabbing;
}

.bookmarks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    min-height: 50px;
    padding: 5px;
    border: 2px dashed transparent;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.bookmarks.drag-over {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.bookmark-card {
    background: white;
    border-radius: 6px;
    padding: 10px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    position: relative;
    border: 1px solid transparent;
}

.bookmark-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.bookmark-card.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.bookmark-icon {
    width: 24px;
    height: 24px;
    margin: 0 auto 8px;
    display: block;
    border-radius: 4px;
    object-fit: cover;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #667eea;
}

.bookmark-icon img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
}

.bookmark-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 4px;
    line-height: 1.3;
}

.bookmark-url {
    display: none;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 0.87rem;
    font-weight: 500;
}

.close {
    font-size: 19px;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

#newCategory {
    margin-top: 10px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

.form-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.67rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#cancelBtn {
    background: #f0f0f0;
    color: #666;
}

#cancelBtn:hover {
    background: #e0e0e0;
}

#saveBtn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

#saveBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* 右键菜单 */
.context-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    display: none;
    min-width: 120px;
    overflow: hidden;
}

.menu-item {
    padding: 8px 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s ease;
    font-size: 0.67rem;
}

.menu-item:hover {
    background: #f0f0f0;
}

.menu-item i {
    width: 16px;
    text-align: center;
}

/* 消息提示动画 */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Footer样式 */
.footer {
    text-align: center;
    margin: 40px 0;
    padding: 20px 0;
    color: white;
    font-size: 14px;
    border-top: 1px solid #eee;
}

.footer p {
    margin: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    header h1 {
        font-size: 1.33rem;
    }
    
    .bookmarks {
        grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
        gap: 8px;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-body {
        padding: 20px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 拖拽排序样式 */
.sortable-ghost {
    opacity: 0.4;
}

.sortable-chosen {
    transform: scale(1.05);
}

.sortable-drag {
    transform: rotate(5deg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* 分类拖拽样式 */
.category-ghost {
    opacity: 0.5;
    background: rgba(102, 126, 234, 0.1) !important;
    border: 2px dashed #667eea !important;
}

.category-chosen {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.category-drag {
    transform: rotate(2deg);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}